home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_10_04
/
1004111a
< prev
next >
Wrap
Text File
|
1992-02-08
|
545b
|
32 lines
Listing 10
******
#include <stdarg.h>
int maximum(int count, int first,...);
main()
{
int ret;
ret = maximum(6, 2,3,4,5,9,8);
printf("Maximum is %d\n", ret);
}
int maximum(int count,int first,...)
{
va_list arguments;
int i;
int value;
int maximum = first;
va_start(arguments, first);
for (i = 0; i < count - 1; i++)
{
value = va_arg(arguments, int);
if (value > maximum)
maximum = value;
}
va_end(arguments);
return maximum;
}
*****